Search and replace
Tip: While search and replace can be an efficient way to update multiple records simultaneously, care should always be taken. If you intend to make changes to a large number of records, it is advisable to perform a test on a subset of records first to avoid any unexpected consequences.
Available in Result set View toolbar, the Search and replace tool allows authorized users to perform two broad functions:
- To replace a value in one or more fields in the current record The record currently displayed in Record details View or highlighted (with a solid grey background) in Result set View or Gallery View for instance. or all marked Marking a record means selecting it by adding a tick to the record's checkbox in Result set View or Gallery View, and in Record Details View from Collections 1.15 onwards. One or more records can be marked and then actioned in some way (e.g. printed). records.
Search and replace can be used to:
- correct a repeated misspelling (e.g. replacing baner with banner), or standardize a term (e.g. replacing ax with axe);
- change the case of the value in a field, e.g. UPPERCASE with Title case;
- standardize formatting, e.g. remove spaces between letters in an acronym, e.g. A G M with AGM;
- replace one linked record with another record;
- change the status of a record (replace one value in a list with another value);
- remove a value from a field;
- remove an occurrence; and so on.
Replace a value in one or more recordsIt is possible to replace a value in one or more fields in the current record or all marked records:
- To replace a value in more than one record, mark Marking a record means selecting it by adding a tick to the record's checkbox in Result set View or Gallery View, and in Record Details View from Collections 1.15 onwards. One or more records can be marked and then actioned in some way (e.g. printed). the records to be processed.
Note: To perform a search and replace operation on all records listed in Result set View, it is necessary to mark all the records (select Mark all records from the toolbar).
- Open the Search and replace box:
- Use a keyboard shortcut, CTRL+H
-OR-
- Click the Search and replace button in the Result set View toolbar:
- Use a keyboard shortcut, CTRL+H
3. Select one or more fields to be searched for the value to be replacedFirst we select the system field name for each field that will be searched for the value that will be replaced.
Tip: See Field level help: Help View, Field properties and Tooltip for details about how to identify a field's system name.
- In the list of system field names on the left:
- Scroll through the list
-OR-
- Start typing a name in the text field above the list to filter the list to matching names.
- Scroll through the list
- Select a field in the list and click Add to move it to the right hand column (or double-click the field name):
Note: To select multiple fields individually, press the CTRL key as you click field names. To select a number of consecutive fields, press and hold the SHIFT key as you click a field and then click another field higher or lower in the list (all fields from the first clicked field to the second will be selected).
- Add as many fields as required:
Note: If you are using the Search and replace tool to add an occurrence of a field, you would typically only add a single field.
4. Specify the value to be replaced, and the replacement value- In the Replace field enter the value to be searched for and replaced.
- In the With field enter the replacement value:
What value you enter in the With field will depend on your objective:
Delete a valueTo delete a value from a field rather than replace it, enter the value to be deleted in the Replace field and leave the With field empty:
In this case when the word goodbye is found in a specified field, it will be deleted (in effect, we replace it with nothing, a NULL value).
IMPORTANT: deleting a value from a repeated field (an occurrence)
The Remove occurrence option1 can be used to remove an occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. from a record (details below). If this option is not selected (or it is unavailable in your version of Collections), it is important to understand the effect of deleting a value from a repeated field.
DetailsAn occurrence is a field designed to be repeated because more than one value is possible for the field (e.g. a book can have more than one author so the author.name (au) field is repeatable). A single field can be configured to be repeatable, and groups of fields can be configured to be repeated together. For example, Creator (creator (VV)) is a member of a group that includes five repeatable fields (Creator, Qualifier, Role, Place and Production notes); when we add an occurrence of any one of these fields, all five fields are added together (full details about occurrences here):
When the Remove occurrence option is not selected, or it is not available in your system, deleting a value in a repeatable field using Search and replace will remove the occurrence from a record but only if:
- it is the last (trailing) occurrence (Repeated group 3 in the example above)
-AND-
- it is a single repeated field or there are no values left in any of the fields in the group.
For example, if we use Search and replace to search for
Atkins, Nancy
in the Creator field and delete it (by replacing it with nothing), all five fields in Repeated group 3 will be removed from the record as it is the trailing occurrence and all fields in Repeated group 3 are now empty:If instead we use Search and replace to search for
Winneke, Angus
in the Creator field and replace it with nothing, Repeated group 2 will remain and will need to be removed from the record manually:Replace a value in a read-only drop list (enumerative field)Enumerative Read-only drop lists; their values are added and translated by Application Administrators in the Collections administration tool, Axiell Designer: users can select a value in an enumerative field, but cannot add or translate a value. fields are read-only drop list of values, such as name.status (ts) and name.type (do):
When performing a search and replace on an enumerative field, it is necessary to replace a value with another value in the drop list.
Multilingual environments
The replacement value (entered in the With field) should be in the current User Interface language not the Data language (details about the difference between the two can be found here).
Replace everything in a fieldTo replace all content in one or more fields with new content we can use the
*
wildcard character:- Enter
*
in the Replace field. - Enter the new replacement content in the With field.
Note: In this case you can ignore the match options at Step 5 below.
Add a value to an empty fieldTo add a value to empty fields only:
- Enter nothing in the Replace field.
- Enter a value in the With field.
Note: In this case you can ignore the match options at Step 5 below.
Add / replace a link to a recordBy selecting a Linked field A type of field used to link one record to another. A Linked field is a drop list of values (records that the field can link to). When a link is made, the field stores a reference to the linked record (a linkref). at Step 3 it is possible to make / replace a link between records.
The target data source A link is made from a record in one data source (primary) to a record in another data source (target). A data source could be both the primary and target data source in a linking relationship if one of its records links to another of its records. will be searched for a record that matches the value entered in With; if the value in With does not already exist in the target data source, you will be asked to confirm whether the value should be added to that data source (and a record will be created in the target data source).
Keep in mind that you are modifying one or more records in the primary data source: while it is possible to add a value to the target data source, you do not change an existing value in the target data source.
This has implications if your objective is to replace a non-preferred term with a preferred term.
Details: replacing a non-preferred term with a preferred termDetails about Authority data sources and preferred / non-preferred terms can be found here.
Here we consider the implications of using search and replace in a field that links to an Authority data source.
Example
In the Object catalogue you search for the term bike in a field linked to the Thesaurus and replace it with a new term of bicycle. Two things happen: because there was no record for the term bicycle in the Thesaurus, a record for the term is created, and then the link in the Object catalogue record is changed so that it points to the new Thesaurus record. All that has happened to the Thesaurus record for the term bike is that the Object catalogue record no longer links to it.
Note: You have not replaced the word bike with bicycle, you have replaced a link to a record for the term bike with a link to a record for the term bicycle.
If your aim is to update records in the primary data source A link is made from a record in one data source (primary) to a record in another data source (target). A data source could be both the primary and target data source in a linking relationship if one of its records links to another of its records. to use a preferred term in an Authority data source, consider whether it is better to make changes in the Authority database rather than using Search and replace. By specifying that term A is the Use (aka preferred) term for term B, anywhere that term B is linked will automatically update to point to term A.
In this example, if the Thesaurus record for bicycle is made the Use term for bike, any Linked field in any data source The management of a collection can involve a vast amount of information about objects / items / books, people and organizations, events, administration and more. This information is stored as records in data sources. Each data source stores a specific type of information: details about collection items, people, events, loans, and so on. that links to the record for bike will automatically display bicycle instead.
Replacing a non-preferred term
If you do replace a non-preferred term that has more than one preferred term, you will need to select the desired preferred term from the More than one preferred term found box that opens automatically when you run Search and replace.
Add / replace a tick in a checkbox fieldHere we see the Publish on web (publish_on_web (wp)) field on the Management details panel:
When a checkbox is not selected (it does not contain a tick), it is obviously empty and its value is NULL.
To search for records in which the Publish on web checkbox is unticked, we could perform the following Advanced search:
publish_on_web = ""
When a checkbox is selected, the value stored in the field is an
x
.Tip: An Advanced search for publish_on_web = x will return all records where the Publish on web checkbox is ticked.
Thus, to search for records where the Publish on web checkbox is ticked and remove the tick, we search for
x
and replace it with nothing:Do the opposite to add a tick to a checkbox (search for nothing and replace it with an
x
).5. Specify one or more options: radio buttons and sliders (or checkboxes)Note: Depending on your version of Collections, you will find some Search and replace options controlled by a checkbox or a slider (Collections version 1.17 onwards). The functionality is identical. Enable a checkbox by clicking it so that it has a tick; enable a slider by sliding it so that it has a blue background.
Match entire fieldIn order to be replaced, the entire contents of a field must match the value in the Replace field except for case (see Match case).
Example
We want to locate The Oxford Dictionary and replace it with The Concise Oxford Dictionary:
A field only needs to contain the three words in the same order regardless of case in order to be matched and replaced. All of these would be matched:
- the oxford dictionary
- The Oxford dictionary
- the Oxford Dictionary
If the Match case option is also enabled, only
The Oxford Dictionary
would be replaced.Match whole wordIn order to be replaced, a value must be found exactly as it appears in the Replace field except for case (see Match case).
Example
We want to locate term and replace it with word:
A replacement will only occur if the word term or Term is found in the field:
- A search term will become A search word.
- A search Term will become A search word.
- If a field contains terms or terminal for example, no replacement will occur.
If the Match case option is also enabled, only term will be replaced (A search Term will be unchanged).
Match sub stringsThe value in the Replace field only needs to be found somewhere in a field (even if it is only part of a word) in order to be replaced. Excludes case unless Match case is also enabled.
Example
We want to locate organization and replace it with institution:
A replacement will occur if organization is found somewhere in the field:
- organizational change will become institutional change.
- Organizational change will become institutional change.
If the Match case option is also enabled, then Organizational change will be unchanged.
Take care with this option as you can receive unexpected results. In previous examples, we replaced term with word:
Unmonitored, this could result in nonsense:
Match caseEnable this option to make the search for the replacement value case-sensitive: when enabled, map will change map but not Map.
If the search term in Replace is a phrase, the case of every word in the phrase must match: Search term will change Search term but not search Term.
Confirm replacementThis option is enabled by default: each change will be shown as it is processed and you will need to confirm the change before it is executed:
Important: while it is possible to cancel the search and replace, any changes you have already accepted will be processed.
If you are making changes to lots of records, confirming each replacement can be a slow process; perhaps use this option to test a subset of records and if the change is as expected, run the search and replace on the remaining records with this option turned off.
Add new occurrenceEnable only if you want to add an occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. of a field.
Enter a value in With to populate the newly added field with that value.
Details about occurrences can be found here.
Remove occurrenceEnable this option to remove an occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. when the Replace value is matched in the searched field.
Note: Remove occurrence was introduced with Collections version 1.13. If you use an earlier version of Collections or do not select the Remove occurrence option, it is important to understand the effect of deleting a value from an occurrence. Details above.
An occurrence is a field designed to be repeated because more than one value is possible for the field (full details about occurrences here). A single field can be configured to be repeatable, and groups of fields can be configured to be repeated together. For example, Creator (creator (VV)) is a member of a group that includes five repeatable fields (Creator, Qualifier, Role, Place and Production notes):
To remove an occurrence from a record:
- Select a repeatable field to be searched.
- Specify a Replace value to be matched.
- Enable the Remove occurrence option.
- Click OK.
If the Replace value is found in the specified repeatable field, the field is removed from the record; in the case of a repeated group of fields, all fields in the group are removed when the Replace value is found in one of the group's fields.
Given the screen capture above, if we search creator (VV) for
Smith, Fred
and enable the Remove occurrence option:all five fields in the repeated group are removed when the search value is discovered in creator (VV):
Current / MarkedIf you marked Marking a record means selecting it by adding a tick to the record's checkbox in Result set View or Gallery View, and in Record Details View from Collections 1.15 onwards. One or more records can be marked and then actioned in some way (e.g. printed). records before accessing the Search and replace box, the Marked radio button will be selected. If you decide you only want to apply the search and replace to the current record The record currently displayed in Record details View or highlighted (with a solid grey background) in Result set View or Gallery View for instance., select the Current radio button.
If you did not mark any records, the Current radio button will be selected; if you select the Marked radio button and run the search and replace, an alert will indicate that no records are marked and the search and replace will fail.
Language drop listThe Language drop list displays in multilingual environments:
- Select a data language to perform your search and replace in the selected language only.
- If you add a new occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. and a value, the occurrence will be added in all available languages but the value will only be added to the selected language.
Note: By default, the language selected in the drop list is the current data language selected in the Main Menu. If you do not select a language from the drop list, your search and replace operation will occur in the current data language.
Notes
A field must be configured to be multilingualIn order to replace / add a value in a specific language, the field in which the operation will occur must be a multilingual field. Even in a multilingual environment, not all fields are configured to be multilingual. Here we see the Field properties for object_name.notes (OO) in a multilingual environment:
Any value added to this field with search and replace will appear in every language no matter what language is selected from the drop list.
Dealing with Invariant valuesIn a multilingual environment, an invariant value is one that displays in any available language until a translation is provided: if an invariant value is English and it has not been translated into German, the English value will display when the Data language is German until a German translation of the value is provided. Although, the invariant value is not technically saved in the German record, it is necessary to treat the German field as if it holds the English value when performing a search and replace in German: in other words, we must treat the German field as if it is not empty.
An example will make this clearer. The Title field is a multilingual field:
- The English value is Count Dracula and it is an invariant value.
- The Title field has not been translated in German.
- To use Search and replace to update the German field:
- Select German from the Language drop list.
- Enter Count in the Replace field.
- Enter Graf in the With field.
- Enable the Match whole word option.
- Click OK to run the search and replace or add a new occurrence:
- If you enabled the Confirm replacement option, a box will display detailing each change before it is made, allowing you to accept or reject each one in turn, or to cancel the process (details above).
- If you added a Linked field A type of field used to link one record to another. A Linked field is a drop list of values (records that the field can link to). When a link is made, the field stores a reference to the linked record (a linkref). at Step 3 and:
- the value in With does not already exist in the target data source A link is made from a record in one data source (primary) to a record in another data source (target). A data source could be both the primary and target data source in a linking relationship if one of its records links to another of its records., you will be asked to confirm whether the value should be added to the target data source.
- try to replace a non-preferred term that has more than one preferred term, a box will display requiring you to select a preferred term.
When the process has completed a summary of the process will display:
- Click OK to exit and finalize the process.
- To add an occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. of a field and a value to one or more records (details below).Add an occurrence to one or more recordsIn a multilingual environment
If you add a new occurrence and a value in a multilingual environment, the occurrence will be added in all available languages but the value will only be added to the language selected in the Language drop list (details above).
- Select the system field name for the occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. field and click Add:
Note: Be sure that the field is repeatable (if you are unsure, try to add an occurrence of the field to a record before running this process). If you use the Search and replace box to add a field that is not repeatable, it will be stored in the record but hidden.
- Enter a value in the With field to populate the new occurrence with that value.
Note: Be sure to use the correct data type for the field: text for a text field, numeric for a numeric field, etc. If unsure, check the Field properties box for the field.
Do not add a value to the Replace field.
- Enable the Add new occurrence option.
- Click OK to add the new occurrence and value to the current or marked record(s).
If the value in With does not already exist in the target data source A link is made from a record in one data source (primary) to a record in another data source (target). A data source could be both the primary and target data source in a linking relationship if one of its records links to another of its records., you will be asked to confirm whether the value should be added to the target data source. If you choose No, the value will not be added to the target data source and the occurrence will not be added either.
Keep the following in mind:
- A second occurrence will not be added to a record if the first occurrence is empty: instead, the first occurrence will be filled with the value you entered in With.
- An occurrence of a field is often a member of a group of fields and adding an occurrence of one member in a group, adds all members of the group at once.
For example, Creator (creator (VV)) is a member of a group called Production, which includes five fields (Creator, Qualifier, Role, Place and Production notes); when we add an occurrence of one of these fields, all five fields are added:
- Typically you would not add more than one field at Step 3: it is only possible to specify a single value in the With field, and it would only make sense to add two or more fields at Step 3 if the target fields could hold the same With value.
More details
- More details about occurrences and working with them can be found here.
- Select the system field name for the occurrence If a field in the current record can have more than one value, we add an occurrence of the field for each value (e.g. a book can have multiple authors so we add an occurrence of the author.name (au) field for each author). An occurrence can be a member of a group of fields, and adding an occurrence of the field adds all members of the group at once. field and click Add: